//
// Created by Tony on 2024/1/27.
//

#ifndef FILE_READER_BINARY_FILE_H
#define FILE_READER_BINARY_FILE_H

#include <cstdint>
#include <string>
#include <vector>

class BinaryFile {
    static constexpr int INT8_BITS = 8;
    static constexpr int INT32_BITS = 32;
    static constexpr int INT64_BITS = 64;

    std::string absPath;
    std::vector<char> content;
    size_t cursor;

public:
    explicit BinaryFile(std::string absPath);

    void append(const char* buf, size_t len);

    uint8_t readUint8();
    uint16_t readUint16();
    uint32_t readUint32();
    uint64_t readUint64();
    std::vector<uint16_t> readUint16s();
    std::vector<char> readBytes(size_t n);
};

#endif // FILE_READER_BINARY_FILE_H
